package dell.yangzhou;

import java.util.Comparator;

public class LambdaTest01 {
    public static void main(String[] args) {
//test1();
     //   test2();
        test3();
    }

//方法引用
    private static void test3() {
       Comparator<Integer>com3=Integer::compare;
       int compare3=com3.compare(1,10);
        System.out.println(compare3);
    }

    //lambda表达式有参且两参数进行比较的情况
    private static void test2() {
        Comparator<Integer> com2=(o1,o2)->Integer.compare(o1,o2);
        int compare2=com2.compare(32,11);
        System.out.println(compare2);
    }

    private static void test1() {
        Runnable r1=new Runnable() {
            @Override
            public void run() {
                System.out.println("天安门");
            }
        };
        r1.run();
        System.out.println("==================");
        //lambda表达式输出
        Runnable r2=()->System.out.println("天安门");

        r2.run();
    }
}
